data<-read.table("input_expr",sep="\t",head=T)
color<-read.table("combined_clinical_batch.txt",sep="\t",head=T)
dim(data)
dim(color)
color[1,]
color1$CODE1<-color$CODE
color$CODE1<-color$CODE
table(color$CODE)
color$CODE1<-gsub("GSE1456","1",color$CODE1)
color$CODE1<-gsub("GSE17705","2",color$CODE1)
color$CODE1<-gsub("GSE2990","3",color$CODE1)
color$CODE1<-gsub("GSE4922","4",color$CODE1)
color$CODE1<-gsub("GSE4922","5",color$CODE1)
color$CODE1<-color$CODE
color$CODE1<-gsub("GSE1456","1",color$CODE1)
 table(color$CODE1)
color$CODE1<-gsub("GSE17705","2",color$CODE1)
color$CODE1<-gsub("GSE2990","3",color$CODE1)
color$CODE1<-gsub("GSE4922","4",color$CODE1)
color$CODE1<-gsub("GSE7390","5",color$CODE1)
 table(color$CODE1)
color[1,]
color1<-t(cbind(color$CODE1,color$CODE1))
colnames(color1)<-rownames(color[,1])
rownames(color1)<-c("batch","batchname")
color1[,1:2]
rownames(color[1:3,1])
color[1,]
colnames(color1)<-color[,1]
color1[,1:2]
length(colnames(data))
color1<-color1[,as.character(colnames(data))]
color2<-color1[,colnames(data)]
color2<-color1[,colnames(color1)]
dim(color2)
color1<-color1[,colnames(color1)]
color1[1,]
library(Hmisc)
library(gplots)
library(heatmapplus)
library(heatmap.plus)
library("heatmap.plus")
install.packages("heatmap.plus")
library("heatmap.plus")
data<-as.matrix()
dim(data)
data<-as.matrix(data)
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
color.matrix<-color1
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output.pdf")
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
pdf("output.pdf")
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="EXPR SAMPLE BY SAMPLE HEATMAP")
dev.off()
savehistory("heatmap_sample_sample_expr.R")
